DECLARE @xml XML

SET @xml = 
    (
        SELECT
            FragmentId
        ,   [DisplayName] = CAST('<![CDATA[' + ISNULL(FragmentDisplayName,ISNULL(FragmentName,'')) + ']]>' AS xml)
        FROM
            Fragment
        WHERE
            DocumentId IS NULL
        FOR XML AUTO, ELEMENTS, ROOT('Fragments')
  )

SELECT @xml
